def animate(f):
fig = plt.figure(figsize=(6,6))
ax = fig.add_subplot(111, projection='3d')
def update(frame):
ax.clear()
f(fig, ax, frame)
ax.view_init(frame*15+20, frame*60)
return
ani = FuncAnimation(fig, update, frames=np.linspace(0, 1.0, 180), init_func=None, blit=False, interval=66)
plt.close()
return ani.to_html5_video()
def f(fig, ax, frame):
e1_ = [1.0, 0.5, 0.01, 0.5, 0.01, 1.0]
e2_ = [1.0, 0.01, 1.0, 0.5, 0.01, 0.5]
fe1 = interpolate.interp1d(np.linspace(0, 1.0, len(e1_)), e1_)
fe2 = interpolate.interp1d(np.linspace(0, 1.0, len(e2_)), e2_)
e1 = fe1(frame)
e2 = fe2(frame)
points = sample_superellipsoid_fibonacci_v2(a, b, c, e1, e2, 5000)
ax.set_title("$e_1={}$, $e_2={}$".format(np.round(e1,2),np.round(e2,2)))
ax.scatter(points[:,0], points[:,1], points[:, 2], c=-points[:,2], cmap="gist_rainbow")
HTML(animate(f))